package cn.jly.springboot24.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.util.UrlPathHelper;

/**
 * @PackageName cn.jly.springboot24.config
 * @ClassName WebMvcConfig
 * @Description 自定义web mvc某些配置
 * @Author 姬岚洋
 * @Date 2021/1/17 下午 5:55
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    /**
     * 配置路劲映射规则
     *
     * @param configurer
     */
    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        final UrlPathHelper urlPathHelper = new UrlPathHelper();
        urlPathHelper.setRemoveSemicolonContent(false);
        configurer.setUrlPathHelper(urlPathHelper);
    }

//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new LoginHandlerInterceptor())
//                // 拦截所有
//                .addPathPatterns("/**")
//                // 但是放行登录请求和静态资源
//                .excludePathPatterns("/login", "/css/**", "/js/**", "/fonts/**", "/images/**");
//    }
}

